www.gusucode.com > 落叶冰点万能企业网站内容管理系统 V9.1 > 落叶冰点万能企业网站内容管理系统 V9.1\code\admin\D_do_upfile.asp
<%Server.ScriptTimeOut=5000%> <% dir_set="../" %> <!--#include file=../inc/conn.asp--> <!--#include file=inc/checkadmin1.asp--> <!--#include file=../inc/ND_class_function.asp--> <!--#include FILE="upload_5xsoft.asp"--> <!--#include file=../inc/jpeg_draw.asp--> <html> <head> <title>文件上传</title> </head> <body> <% '************************************************************** ' 新动软网站管理系统 ' 官方网站: http://www.aspcpu.com ' 系统作者: 阮丁远(网名:天下程序) ' Copyright 新动软网站管理系统 版权所有 '************************************************************** %> <% '===================================================================================== if session(nd_admin_cach_varb_name)="" then if request.cookies(nd_admin_cach_varb_name)="" then uuuaa="" else uuuaa=request.cookies(nd_admin_cach_varb_name) end if else uuuaa=session(nd_admin_cach_varb_name) end if set rs22ff=server.CreateObject("adodb.recordset") rs22ff.open "select * from "&biao3&" where aname='"&uuuaa&"'",conn,1,3 if rs22ff("last_upload_time")&""="" then rs22ff("last_upload_time")=date() rs22ff.update end if if rs22ff("last_upload_time")<>date() then rs22ff("last_upload_time")=date() rs22ff("day_upload_count")=1 sssccd=1 rs22ff.update else sssccd=rs22ff("day_upload_count")+1 rs22ff("day_upload_count")=rs22ff("day_upload_count")+1 rs22ff.update end if unlod=0 if qx_shangc="0" and qx_if_max=0 then unlod=1 %> <script language=javascript> alert("您没上传文件的权限!") </script> 您没上传文件的权限 <% response.end end if if clng(sssccd)>clng(qx_shangc_num) and qx_if_max=0 then unlod=1 %> <script language=javascript> alert("超过一天能最多上传的文件个数,无法上传!") </script> 超过一天能最多上传的文件个数,无法上传! <% response.end end if '===================================================================================== if unlod=0 then dim upload,file,formName,formPath,iCount set upload=new upload_5xsoft ''建立上传对象 Function RelativePath2RootPath(url) Dim sTempUrl sTempUrl = url If Left(sTempUrl, 1) = "/" Then RelativePath2RootPath = sTempUrl Exit Function End If Dim m_strPath m_strPath = Request.ServerVariables("SCRIPT_NAME") m_strPath = Left(m_strPath, InStrRev(m_strPath, "/") - 1) Do While Left(sTempUrl, 3) = "../" sTempUrl = Mid(sTempUrl, 4) m_strPath = Left(m_strPath, InStrRev(m_strPath, "/") - 1) Loop RelativePath2RootPath = m_strPath & "/" & sTempUrl End Function formPath=upload.form("filepath") ''在目录后加(/) if right(formPath,1)<>"/" then formPath=formPath&"/" iCount=0 randomize ranNum=int(999*rnd) filename=year(now)&month(now)&day(now)&hour(now)&minute(now)&second(now)&ranNum sUploadDir="../uploadfile/image/" strUploadDir = CreatePath(sUploadDir) sUploadDir = sUploadDir & strUploadDir formPath=sUploadDir err1=0 for each formName in upload.objFile ''列出所有上传了的文件 set file=upload.file(formName) ''生成一个文件对象 if file.FileSize>D_u_AllowFilesize then response.write "文件太大,上传失败! <a href=D_upfile.asp>重新上传</a><script>alert('文件太大,上传失败!');</script>" err1=1 end if eee1=File.FileName extnm=mid(eee1,inStrRev(eee1,".")+1,len(eee1)-inStrRev(eee1,".")) okkk=0 ssss111=split(D_u_AllowFileExt,"|") for iyy=0 to ubound(ssss111) ssss1112=ssss111(iyy) if lcase(trim(cstr(ssss1112)))=lcase(trim(cstr(extnm))) then okkk=1 exit for end if next if okkk=0 then err1=1 response.write "文件类型不正确,上传失败! <a href=D_upfile.asp>重新上传</a><script>alert('文件类型不正确,上传失败!');</script>" end if if file.FileSize>0 and err1=0 then ''如果 FileSize > 0 说明有文件数据 file.SaveAs Server.mappath(formPath&filename&"."&extnm) ''保存文件 call do_shuiying(formPath&filename&"."&extnm) ' response.write file.FilePath&filename&" ("&file.FileSize&") => "&formPath&File.FileName&" 上传成功!<br>" ttttppppt=RelativePath2RootPath(formPath&filename&"."&extnm) response.write File.FileName&" 上传成功! <a href=D_upfile.asp>继续上传</a><br><script language=javascript>try{parent.addUploadFile('" & "" & "', '" & "" & "', '" & ttttppppt & "');} catch(e){}</script>" end if set file=nothing next set upload=nothing ''删除此对象 end if %> </body> </html>